package cn.wolfcode.shop.cloud.msg;

import cn.wolfcode.shop.cloud.common.CodeMsg;

import java.text.MessageFormat;

public class MemberCodeMsg extends CodeMsg {
    public MemberCodeMsg(int code, String msg) {
        super(code, msg);
    }

    public MemberCodeMsg() {
    }

    public static final MemberCodeMsg USERNAME_AND_PASSWORD_NOT_NULL = new MemberCodeMsg(50101, "账号和密码不能为空");

    public static final MemberCodeMsg USER_NOT_EXISTS = new MemberCodeMsg(50102, "该用户不存在");
    public static final MemberCodeMsg PASSWORD_ERROR = new MemberCodeMsg(50103, "账号和密码不匹配");
    public static final MemberCodeMsg PARARM_ERROR = new MemberCodeMsg(50104, "参数异常:{0}");

    public MemberCodeMsg filterArg(String... arg) {
        MemberCodeMsg memberCodeMsg = new MemberCodeMsg();
        //this是谁,谁调用这个方法this就是谁
        //new MemberCodeMsg(50104, "参数异常:{0}");
        memberCodeMsg.setCode(this.getCode());
        memberCodeMsg.setMsg(MessageFormat.format(this.getMsg(),arg));
        return memberCodeMsg;
    }

}
